package Point;

import java.util.Arrays;
import java.util.Comparator;
import java.util.Random;

public class PointTest {
    public static void main(String[] args) {
        Random random = new Random();
        Point[] points = new Point[100];
        for (int i = 0; i < points.length; i++) {
            int x = random.nextInt(100);
            int y = random.nextInt(100);
            points[i] = new Point(x, y);
        }
        Arrays.sort(points,new Comparator<Point>() {
            public int compare(Point o1, Point o2) {
                if(o1.x>=o2.x)
                    return -1;  //从大到小
                else
                    return 1;
                //return o1.x - o2.x;
            }
        });
        for(Point point:points){
            System.out.println(point.toString());
        }
    }
}
